package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.huashigang.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Author wpj
 * @Date 2020/10/6
 */
@Cmd(code = GameProtocol.S_HUA_SHI_GANG_OPEN_BOX_FROM_CROSS, desc = "成功打开宝箱跨服返回")
public class OpenBoxFromCrossCmd extends AbstractCommand {

    int boxId;
    String reward;
    int stat;
    int num;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.OpenBoxRespToGameServerMsg msg = HuaShiGangProto.OpenBoxRespToGameServerMsg.parseFrom(packet.getBytes());
        boxId = msg.getBoxId();
        reward = msg.getReward();
        stat = msg.getRet();
        num = msg.getNum();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        HuaShiGangMgr.openBox(player, boxId, reward, stat, num);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
